﻿using HalconDotNet;
using Halcon二次开发.Controller.数据加载与保存;
using Halcon二次开发.Controller.文本显示;
using Halcon二次开发.Model;
using Halcon二次开发.Model.储存每个Controller的单例对象;
using Halcon二次开发.Model.储放所有单例.储存每个单例界面;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Halcon二次开发.View.文本显示工具
{
    public partial class MessageBoxTextForm : Form
    {
        public MessageBoxTextController controller = null;

        public MessageBoxTextForm()
        {
            InitializeComponent();
            controller= new MessageBoxTextController();
        }
        /// <summary>
        /// 反射调用的方法，请不要修改
        /// </summary>
        /// <param name="path">Json文件的路径</param>
        /// <param name="addres">节点</param>
        public void SetJsonPaths(string path, string addres)
        {
            string paths = path + "\\" + "界面数据\\" + addres + "\\" + addres + "数据.json";
            //调用存储方法
            new LoadData().LoadDatas(paths, this);
        }
        //运行按钮
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            try
            {
                controller.Run();
            }
            catch (Exception ex)
            {
                MessageBox.Show("坐标转换异常："+ex.Message,"异常",MessageBoxButtons.OK,MessageBoxIcon.Warning);
                (FormDb.Db["Form1"] as Form1).textBox1.AppendText(this.Name + ":" + ex.Message + "\r\n");
            }
        }
        //清除文本
        private void toolStripButton2_Click(object sender, EventArgs e)
        {

        }
        private void MessageBoxTextForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            e.Cancel = true;
        }
    }
}
